package team.seekers.catering.common.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

/**
 * 饮食意向枚举
 */
@Getter
public enum ConfigTypeEnum implements IEnum<Integer> {


    PACKAGE_ORDER_NUMBER(1, "各种不同打包方式的订单序号"),

    TIME_QUANTUM(2,"时间段的标志位"),

    //可以考虑存数据库
    TIME_DIVISION(3," 12:00:00"),

    ;

    private int type;

    private String name;

    ConfigTypeEnum(int type, String name) {
        this.type = type;
        this.name = name;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static ConfigTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static ConfigTypeEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
